const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
  mode: "none",
  output: {
    filename: "main-[hash:8].js",
  },
  devtool: "cheap-module-source-map",
  // 这里可以修改webpack-dev-server的配置
  devServer: {
    port: 3000,
    proxy: {
      "/api": {
        target: "http://github.com",
        changeeOrigin: true, // 主机名host会修改为github
      },
    },
  },
  plugins: [
    new CleanWebpackPlugin(),
    new HtmlWebpackPlugin({
      template: "./src/index.html",
    }),
  ],
  module: {
    rules: [
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader"],
      },
      {
        test: /\.md$/,
        use: ["./markdown-loader.js"],
      },
    ],
  },
};
